Providing multiple concurrent access to a file system

ABSTRACT

Multiple computers are connected to a data storage unit that includes a file system, which further includes multiple data entities, including files, directories and the file system itself. The file system also includes, for each data entity, an owner field for indicating which computer, if any, has exclusive or shared access to the data entity, along with a time field for indicating when a lease of the data entity began. When a computer wants to lease a data entity, the computer uses a disk reservation capability to temporarily lock the data storage unit, and, if the data entity is not currently leased, the computer writes its own identification value into the owner field and a current time into the time field for the data entity, to claim the data entity for a renewable lease period. If a prior lease of a data entity has expired, another computer may break the lease and claim ownership for itself.

CROSS REFERENCE TO RELATED APPLICATIONS

This application is a continuation of and claims the benefit of U.S.patent application Ser. No. 10/773,613 entitled “Providing MultipleConcurrent Access to a File System” and filed on Feb. 6, 2004, which ishereby incorporated by reference.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to a distributed file system within a computersystem, or, more specifically, to providing multiple computers or othercomputing entities with concurrent access to a file system whilemaintaining the integrity and coherence of the file system.

2. Description of the Related Art

Historically, a file system has often been accessible to only onecomputer at a time. For example, most computers have a local disk drivewithin the computer that contains a file system that historically hasonly been accessible to that computer. If multiple computers are givenconcurrent, unrestricted access to a typical file system the data in thefile system will likely become corrupted. For example, suppose that afirst computer and a second computer are connected to a disk drivecontaining a single file system. The computers may be connected to thedisk drive by a SCSI interface (Small Computer System Interface), forexample. Now if both computers are allowed to read and write file dataand file system configuration data at will, a wide variety of conflictscan occur. As an example, suppose both computers are accessing the samefile on the disk drive, and they both try to write to the end of thefile at the same time. If only one write can actually be performed tothe disk at a time, then the two writes will occur one after the other,and the second write will generally overwrite the data that was writtenin the first write, causing the data of one of the computers to be lost.As another example, suppose that both computers attempt to add a newdirectory to the file system at the same time. Again, a reference to afirst directory created by the first computer may be overwritten by areference to a second directory created by the second computer. Thus, toprovide multiple computers with concurrent access to a common filesystem on a shared data store, without corrupting the data and the filesystem, one or more locking and/or coherence mechanisms must generallybe implemented.

This invention may be implemented in any such situation in which it isadvantageous for multiple computers or other computing entities to haveconcurrent access to a common file system, and this invention willimprove the integrity and coherence of the file system and the datacontained in the file system. The most common such situation in whichthe invention may be advantageously implemented involves multiple servercomputers connected to a data storage unit, such as through a datanetwork. Thus, the preferred embodiment of the invention is described asbeing implemented in such a computer system comprising a data storageunit, multiple servers and some means of interconnecting the serverswith the data storage unit. In many cases when multiple servers areconnected to a data storage unit, however, each server has its own filesystem within the data storage unit, so that concurrent access to acommon file system is not necessary. There are, however, othersituations in which it is advantageous for multiple servers or othercomputers to have concurrent access to a common file system. One suchsituation is where multiple virtual machines (VMs) execute on multiplephysical servers and share the same file system on a shared data store.Implementing the invention in such a system in which multiple VMsexecute on multiple physical servers and share the same file system isparticularly advantageous for several reasons, as described brieflybelow.

Now there are known techniques for enabling multiple computers to sharea common file system. FIGS. 1A and 1B, for example, illustrate twodifferent system configurations that have been used to give multipleservers access to a common file system.

FIG. 1A illustrates a computer system in which multiple servers access acommon file system indirectly, by using a file server as anintermediary. FIG. 1A shows a plurality of servers 10, 12 . . . 18connected together through a local area network (LAN) 20, which alsointerconnects with a file server 30. The file server 30 is connected toa data storage unit 40.

The data storage unit 40, illustrated in FIG. 1B and in other figures inthis application, may be any data storage medium or any combination ofdata storage media that can hold a file system. Thus, the data storageunit 40 may be anything from a simple disk drive device to a complexcombination of various data storage devices and/or systems. The datastorage unit 40 includes a file system 41, which may be any conventionalfile system, such as a New Technology File System (NTFS) from MicrosoftCorporation or a UNIX or Linux file system. The file server 30 may be aconventional file server, such as a server based on an x86 architecturefrom Intel Corporation, running a conventional operating system (OS),such as a Linux OS distribution, a Windows OS from Microsoft Corporationor a UNIX OS, along with a standard file server application. The fileserver 30 may be connected to the data storage unit 40 by anyconventional means, such as through a SCSI interface. The local areanetwork 20 may be a conventional computer network, such as an Ethernetnetwork. Also, the servers 10, 12 and 18 may be any conventional server,such as a server based on the x86 architecture, running a conventionalOS.

Now the servers 10, 12 and 18 do not access the file system 41 directly.The server 10 cannot, for example, directly mount the file system 41 ordirectly open a file within the file system 41. Instead, the servers 10,12 and 18 must interact with the file server 30 to obtain access to thefile system 41. For example, the server 10 may request that a directorybe added to the file system 41, but it is the file server 30 thatactually accesses the file system 41 to add the directory. Similarly, ifthe server 12 desires access to a file within the file system 41, thefile server 30 actually reads data from the file or writes data to thefile, as requested by the server 12. In this configuration, only oneserver, namely the file server 30, ever has access to the file system41. Thus, this is not a distributed file system, in which multiplecomputers have concurrent access to a common file system.

The configuration of FIG. 1B is not desirable in many situations becausethe file server 30 can be a bottleneck that substantially slows down thespeed at which the servers 10, 12 and 18 may interact with the filesystem 41. Interactions with the file system 41 may only proceed as fastas the file server 30 is able to service the requests of the servers 10,12 and 18 and transfer the data between the servers and the data storageunit 40. Also, the file server 30 represents a single point of failurein the servers' ability to access the file system 41. A distributed filesystem is generally desirable in such situations, so that each of theservers 10, 12 and 18 may access the data storage unit 40 independentlyand redundantly, without having to go through the file server 30 toobtain access.

FIG. 1B illustrates a computer system that implements a prior artdistributed file system. In this system, multiple servers access acommon file system through a data storage network, and they communicatelocking information with each other using a separate computer network.FIG. 1B shows the same plurality of servers 10, 12 . . . 18 connectedtogether through the same local area network 20. FIG. 1B also shows thesame data storage unit 40, including the same file system 41. This time,however, the servers 10, 12 and 18 are connected to the data storageunit 40 using a data storage network 32.

The data storage network 32 may be a conventional Storage Area Network(SAN), for example, based on any of a variety of technologies, includingpossibly Fibre Channel technology or SCSI technology. An importantadvantage to using a SAN or similar data storage network 32 is that theentire interface between the servers 10, 12 and 18 and the data storageunit 40 may be made very reliable. First, the data storage network 32may be configured with redundant data paths between each of the servers10, 12 and 18 and the data storage unit 40. Thus, for example, the datastorage network 32 may comprise at least a first path and a second pathbetween the first server 10 and the data storage unit 40. Either thefirst path or the second path may be used to transfer data between theserver 10 and the data storage unit 40. Next, the system may be set upwith failover capabilities, so that, if there is a failure in one datapath between a server 10, 12 and 18 and the data storage unit 40, thesystem may switch over and use another, redundant data path. Thus, forexample, when there is a first data path and a second data path betweenthe first server 10 and the data storage unit 40, and there is a failurealong the first path preventing its use, the system can switch over anduse the second data path to maintain a connection between the server 10and the data storage unit 40.

It is often advantageous to have a fully redundant data storage network32, so that no single failure can prevent any of the servers 10, 12 and18 from accessing their data on the data storage unit 40. Onerequirement of a fully redundant data storage network 32 is that eachserver 10, 12 and 18 must have at least two interface cards forinterfacing with the data storage network. Otherwise, if a server onlyhas a single interface card and a failure on that card prevents its usefor accessing the data storage network 32, then the respective server10, 12 or 18 is prevented from accessing the data storage unit 40. Thus,each of the servers 10, 12 and 18 in FIG. 1B is shown as having a pairof data interface cards. Specifically, the server 10 includes a firstdata interface card 10C and a second data interface card 10D, the server12 includes a first data interface card 12C and a second data interfacecard 12D, and the server 18 includes a first data interface card 18C anda second data interface card 18D. Each of the data interface cards 10C,10D, 12C, 12D, 18C and 18D may be a conventional data interface card forinterfacing with the data storage network 32. For example, if the datastorage network 32 is a Fibre Channel network, then the data interfacecards 10C, 10D, 12C, 12D, 18C and 18D may be Fibre Channel host busadapter cards (HBAs).

Each of the servers 10, 12 and 18 may use the data storage network 32 toaccess the file system 41 in the data storage unit 40. Each of theservers 10, 12 and 18 may have full access to the file system 41,including mounting the file system, reading and modifying configurationdata for the file system, and reading and writing file data within thefile system. Without more, however, the file system 41 would likelybecome corrupted, as described above. Thus, a distributed file systemsuch as the one illustrated in FIG. 1B must place restrictions on theability of the servers 10, 12 and 18 to access the file system 41.

Existing distributed file systems use the exchange of lockinginformation to restrict access to the file system. A few examples ofsuch distributed file systems are the Frangipani file system that wascreated by the Digital Equipment Corporation, the xFS file system thatwas created by the University of California at Berkeley, and the Veritascluster file system, developed by the Veritas Software Corporation.These distributed file systems require that the servers 10, 12 and 18exchange locking information to ensure that they do not access the filesystem 41 in conflicting manners. For example, a first file in the filesystem 41 may have a first lock associated therewith. One of the servers10, 12 and 18 may be designated as a master server with respect to thisfirst lock. Thus, suppose the server 12 is designated as the masterserver with respect to the first lock and that the server 10 desires toaccess the first file. The server 10 must communicate with the server 12and request the first lock. The server 12 must then communicate with theserver 10 to grant it the first lock before the server 10 may access thefirst file. Thus, for such a distributed file system to work, there mustbe some means of communication between the servers 10, 12, and 18.

Although the data storage network 32 enables the servers 10, 12 and 18to interface with the data storage unit 40, such networks typically donot enable the servers 10, 12 and 18 to interface with each other. Thus,computer systems that use a distributed file system such as the oneillustrated in FIG. 1B typically also include a separate network thatmay be used by the servers 10, 12, and 18 to communicate with eachother. FIG. 1B shows a separate LAN 20 that is generally used for thispurpose. Thus, in the example described above, the server 10 may send anetwork packet to the server 12 using the LAN 20, requesting the firstlock, so that it may access the first file. The server 12 may then sendanother network packet back to the server 10 granting it the first lock,and thereby granting it access to the first file.

In the system of FIG. 1B, the LAN 20 is used to enable the servers 10,12 and 18 to communicate with each other to gain access to the datastorage unit 40. The LAN 20 is essential to the servers 10, 12 and 18gaining access to the data storage unit 40. As a result, the reliabilityof the servers' access to the data storage unit 40 is dependent on thereliability of the LAN 20. Put simply, if a server 10, 12 or 18 cannotaccess the LAN 20 to obtain a lock for using the file system 41, itdoesn't matter how reliable the data storage network 32 is. Thus, toimprove the reliability of data access for the servers 10, 12 and 18,redundant paths are preferably also provided for enabling the servers10, 12 and 18 to interface with each other over the LAN 20. Inparticular, each of the servers 10, 12 and 18 is preferably providedwith two network interface cards (NICs) for connecting to the LAN 20.Otherwise, with just a single NIC, a failure in that NIC could preventthe respective server from obtaining a lock required to access its datain the data storage unit 40. Thus, the server 10 includes a first NIC10A and a second NIC 10B, the server 12 includes a first NIC 12A and asecond NIC 12B, and the server 18 includes a first NIC 18A and a secondNIC 18B. Now, for example, if the first NIC 10A fails, the server 10 maystill interface with the LAN 20 using the second NIC 10B.

In many situations, a system such as the system of FIG. 1B is notdesirable for various reasons. First, it may not be desirable to requirea second network such as the LAN 20 to enable the servers 10, 12 and 18to communicate with each other to access the data storage unit 40. Evenif each of the servers 10, 12 and 18 is connected to some other computernetwork, it may not be desirable to ensure that they are all connectedto the same computer network. Second, it may not be desirable to provideeach server 10, 12 and 18 with a pair of NICs just to provide fullredundancy for their access to the data storage unit 40. Third,configuring a system such as the system of FIG. 1B can be complicatedand time-consuming. Each of the servers 10, 12 and 18 must be providedwith a substantial amount of information, such as which servers 10, 12and 18 are permitted to access the file system 41 and individual dataentities within the file system 41, which server is to function as themaster server for each lock, and the IP (Internet Protocol) addresses orother addresses for each of the other servers. Finally, a system such asthe one illustrated in FIG. 1B typically must also employ a complexre-mastering technique that is used whenever a master server of a lockfails, to ensure that another server can become the master server, sothat the remaining servers may still access the data entity secured bythe lock.

What is needed is a distributed file system that enables multiplecomputing entities to have concurrent access to a data storage unit,without having to go through a file server, and without all of thecomplexity, expense and inefficiencies of existing distributed filesystems.

SUMMARY OF THE INVENTION

The invention comprises a method for attempting to access a first dataentity in a file system, the file system also including one or moreadditional data entities that are concurrently accessible to at leastone other computing entity, the file system including an owner field forindicating if the first data entity is leased by a computing entity anda time field for indicating whether a lease for the first data entityhas expired. The method comprises: attempting to obtain a lease on thefirst data entity by performing the following substeps: (a) reserving adata storage unit containing the owner field, (b) if the owner fieldindicates that the first data entity is not currently leased, writing tothe owner field to indicate an assumption of a lease and writing to thetime field to indicate when the lease expires, (c) if the owner fieldindicates that the first data entity has been leased, and the time fieldindicates that the lease is active, writing to the owner field in aqueue to indicate an intention to lease and writing to the time field toindicate when the lease expires, and (d) if the owner field indicatesthat the first data entity has been leased, but the time field indicatesthat the lease has expired, writing to the owner field to break theexisting lease and to indicate an assumption of a new lease and writingto the time field to indicate when the new lease expires; and if a leaseis obtained, accessing the first data entity while the lease is ineffect.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1A illustrates a first prior art system for providing multipleservers with access to a data storage unit.

FIG. 1B illustrates a second prior art system for providing multipleservers with access to a data storage unit.

FIG. 2 illustrates a system in which this invention may be implementedto provide multiple servers with concurrent access to a file systemwithin a data storage unit.

FIG. 3 illustrates a first configuration for locking data that may beused in this invention to enable multiple servers to access a filesystem concurrently.

FIG. 4 is a state diagram illustrating multiple states of availabilitythrough which a data entity transitions when this invention isimplemented.

FIG. 5A is a flow chart illustrating a method that is used in a firstembodiment of this invention for attempting to obtain a lock on a dataentity.

FIG. 5B is a flow chart illustrating a method that is used in a secondembodiment of this invention for attempting to obtain a lock on a dataentity.

FIG. 5C is a flow chart illustrating a method that is used in the secondembodiment of this invention for refreshing a queue.

FIG. 5D is a flow chart illustrating a method that is used in the firstand second embodiments of this invention for renewing a lock on a dataentity.

FIG. 5E is a flow chart illustrating a method that is used in the firstand second embodiments of this invention for releasing a lock on a dataentity.

FIG. 6A illustrates a second configuration for locking data that may beused in this invention to enable multiple servers to access a filesystem concurrently.

FIG. 6B illustrates a third configuration for locking data that may beused in this invention to enable multiple servers to access a filesystem concurrently.

FIG. 6C is a flow chart illustrating a method that may be used forattempting to obtain access to a data entity when either the second orthird configurations for locking data are used.

DETAILED DESCRIPTION

This invention may be implemented in any system in which it isadvantageous for multiple computers or other computing entities to haveconcurrent access to a common file system. A typical situation in whichthe invention may be implemented involves multiple computers beingconnected in some manner to a data storage unit that contains a filesystem. FIG. 2 illustrates one such computer system in which theinvention may be implemented. The system of FIG. 2 includes the servers10, 12 . . . 18 and the data storage unit 40 of FIGS. 1B and 1B. Thedata storage unit 40 includes a file system 42, which may generally bethe same as the file system 41, except for the addition of certainspecific locking information that is described below.

Each of the servers 10, 12 and 18 is connected to the data storage unit40 in some manner. These connections are illustrated in FIG. 2 asgeneral data links 36. Thus, the server 10 is connected to the datastorage unit 40 by a data link 36A, the server 12 is connected to thedata storage unit 40 by a data link 36B, and the server 18 is connectedto the data storage unit 40 by a data link 36N. Each of the data links36A, 36B and 36N may be any type of data link that permits the transferof data between the respective servers 10, 12 and 18, and the datastorage unit 40. The data links 36A, 36B and 36N may be part of a datastorage network 34, which may be substantially the same as the datanetwork 32 shown in FIGS. 1B and 1B. For example, the data storagenetwork 34 may comprise a conventional SAN.

The server 10 is connected to the data link 36A by a data interface 10E,the server 12 is connected to the data link 36B by a data interface 12E,and the server 18 is connected to the data link 36C by a data interface18E. The data interfaces 10E, 12E and 18E may be the same as the datainterfaces 10C, 10D, 12C, 12D, 18C and 18D. For example, if the datalinks 36A, 36B and 36N are part of a Fibre Channel SAN, then the datainterfaces 10E, 12E and 18E may comprise Fibre Channel HBAs. Each of theservers 10, 12 and 18 may also contain a second data interface, asillustrated in FIGS. 1A and 1B. A single data interface is shown in eachof the servers 10, 12 and 18 in FIG. 2 for generality.

As one example configuration for the system of FIG. 2, the servers 10,12 and 18 may be conventional server computers, as described above; thedata links 36A, 36B and 36N may be part of a conventional Fibre ChannelSAN and the data interfaces 10E, 12E and 18E may be conventional FibreChannel HBAs; and the data storage unit 40 may be a conventional storagesystem, containing a generally conventional file system 42. The datastorage unit 40 must implement some temporary locking mechanism,however. For example, the data storage unit 40 may implement diskreserve and release primitives, such as those provided by a SCSIinterface. The only aspects of the system of FIG. 2 that must be uniquein order to implement this invention are some software routines on theservers 10, 12 and 18 for implementing some methods described below andsome data fields within the file system 42, which are also describedbelow.

FIG. 2 also shows that the servers 10, 12 and 18 may each include one ormore VMs 13. Various techniques for implementing VMs are known in theart, and any such technique may be used to implement the VMs 13. VMware,Inc., the assignee of this application, sells several commercialproducts that embody various techniques that may be used to implementthe VMs 13. U.S. patent application Ser. No. 10/319,217 (the “217application”), entitled “Virtual Machine Migration”, which isincorporated here by reference, describes an implementation that may beused for the VMs 13. As mentioned above and as described in greaterdetail below, this invention may be particularly advantageous whenimplemented in computer systems in which multiple VMs, such as the VMs13, execute on multiple servers, such as the servers 10, 12 and 18, andshare a common file system, such as the file system 42.

Turning now to FIG. 3, the data storage unit 40 is shown, including thefile system 42A. The file system 42A may comprise a conventional filesystem, including a plurality of files of various types, typicallyorganized into one or more directories. The file system 42A may includemetadata that specifies information about the file system, such as somedata structure that indicates which data blocks in the file systemremain available for use, along with other metadata indicating thedirectories and files in the file system, along with their location.Each file and directory typically also has metadata associatedtherewith, specifying various things, such as the data blocks thatconstitute the file or directory, the date of creation of the file ordirectory, etc. The content and format of this metadata, for the filesystem and for the individual files and directories, variessubstantially between different file systems. Many existing file systemsare amply documented so that they can be used and modified as describedherein by a person of skill in the art, and any such file system may beused in implementing the invention.

To implement the invention, various additional data fields of metadataare preferably added to the file system 42A, such as a plurality offields that are shown in FIG. 3. First, the file system 42A includes afile system lock 44, which includes an owner data field 45A and a timedata field 45B. The owner data field 45A may be a unit of data, such asa byte, a word, etc., that is used to identify a computing entity thatowns or possesses the lock 44. Possessing the lock 44 gives a computingentity exclusive access to the configuration data of the file system42A. The owner data field 45A may contain a zero or some other specialvalue to indicate that no computing entity currently owns the lock, orit may contain an identification (ID) value of one of the computingentities to indicate that the respective computing entity currently ownsthe lock. For example, each of the servers 10, 12 and 18 may be assigneda unique ID value, which could be inserted into the owner field 45A toindicate that the respective server owns the lock 44 for the file system42A. A unique ID value need not be assigned manually by a systemadministrator, or in some other centralized manner. Instead the IDvalues may be determined for each of the servers 10, 12 and 18 in asimpler, more automated manner, such as by using the server's IP addressor the MAC (Media Access Control) address of the server's networkinterface card, by using the World Wide Name (WWN) of the server's firstHBA or by using a Universally Unique Identifier (UUID). For the rest ofthis description, it will be assumed that a zero is used to indicatethat a lock is not currently owned, although other values may also beused for this purpose.

In the preferred embodiment, locks, such as the lock 44, are owned orpossessed by computing entities on a renewable-lease basis. Thus, when acomputing entity obtains a lock, it preferably owns the lock for aspecified period of time. The computing entity may extend the period ofownership, or the lease period, by renewing the lease. Once the leaseperiod ends, another computing entity may take possession of the lock.The time field 45B indicates, in some manner, whether or not the currentlease has expired. In the preferred embodiment, each lease is for apredetermined period of time, and the time field 45B preferably stores atime value that indicates the time at which the current lease periodbegan. This time value may take the form of a conventional time stampvalue, or it may take some other form, such as a real time value that isused in common by multiple computing entities. The time at which thecurrent lease expires can then be calculated by adding the lease periodto the value in the time field 45B. As another alternative, the timefield 45B may contain a value that does not represent time at all. Forexample, the time field 45B may contain some value that is incrementedwhenever a computing entity renews a lease or it may even include anarbitrary value, so long as the value is modified each time a lease isrenewed. The remainder of this description will assume that the timefield 45A and other time fields contain time values, such as timestamps. When the owner field 45A contains a zero, the value in the timefield 45B is irrelevant.

The file system 42A also includes one or more other data entities. Adata entity may be a file, a directory or the file system 42A itself.Each such data entity has its own lock, similar to the lock 44 shown forthe file system 42A. To gain access to one of these data entities, acomputing entity must gain control of the respective lock. Thus, tochange the configuration data of the file system 42A, such as by addinga new directory, a computing entity must become the owner of the lock44; to change the configuration data of a directory within the filesystem 42A, such as by adding a new sub-directory, a computing entitymust become the owner of the lock that controls the respectivedirectory; and to change the data in a file within the file system 42A,a computing entity must become the owner of the lock that controls therespective file. Also, just to read the data in any such data entity, acomputing entity must become the owner of the lock that controls therespective data entity. An exception to this, however, is that acomputing entity generally has both read and write access to the lockingmetadata described herein for any of the data entities, even if anothercomputing entity controls the lock for such data entity. FIG. 3 shows afile 48A as one such other data entity. The file 48A includes a lock50A, which further comprises an owner data field 51A and a time datafield 51B. The owner field 51A may be substantially the same as theowner field 45A, although with different contents, and the time field51B may be substantially the same as the time field 45B, although againwith different contents.

As an option, in addition to the lock 44, the file system 42A may alsoinclude a queue 46, which is shown in dashed lines in FIG. 3 to indicatethat it is optional. The queue 46 may include one or more next ownerdata fields that are similar to the owner data field 45A. FIG. 3 showstwo such optional next owner data fields, namely a next1 47A and a next247C. These next owner data fields form a queue to indicate computingentities that are waiting to obtain the lock 44. Thus, if the server 10currently owns the lock 44, with the owner field 45A containing the IDvalue of the server 10, the next1 data field 47A may contain the IDvalue of the server 12, indicating that the server 12 is entitled toobtain the lock 44 after the server 10 is finished with it. Similarly,the next2 data field 47C may contain the ID value of the server 18,indicating that the server 18 is entitled to obtain the lock 44 afterboth the servers 10 and 12 are finished with it. The queue 46 may alsoinclude a time value 47B for indicating when an ID value was insertedinto the next1 field 47A and a time value 47D for indicating when an IDvalue was inserted into the next2 field 47C.

Similarly, the file 48A may include a queue 52A that is substantiallythe same as the queue 46, with a next1 data field 53A that issubstantially the same as the next1 data field 47A, a next2 data field53C that is substantially the same as the next2 data field 47C, a timedata field 53B that is substantially the same as the time data field47B, and a time data field 53D that is substantially the same as thetime data field 47D. The optional queue 52A provides a queue for thelock 50A in the same manner that the optional queue 46 provides a queuefor the lock 44. Either the queue 46 or the queue 52A may contain alarger or smaller number of queue entries than illustrated in FIG. 3.Each of the data entities within the file system 42A, including the filesystem 42A itself and each of the directories and files in the filesystem, includes a lock, such as the lock 50A, and possibly a queue,such as the queue 52A.

Each of the locks for the data entities within the file system 42A maytransition between three different possible states. FIG. 4 is a statediagram that illustrates these possible states and the possibletransitions between the states. In describing the state diagram of FIG.4, reference is made to the file 48A of FIG. 3, including the lock 50A,further including the owner field 51A and the time field 51B. Thediagram of FIG. 4 begins at an initial step 100, which leads to a firststate 102. In this first state 102, the data entity (or the lockcontrolling the data entity) is free or available. Thus, at this pointin the state diagram of FIG. 4, the lock 50A is free, and no computingentity is currently entitled to access the file 48A. Thus, the ownerfield 51A contains a zero, indicating that the lock 50A is available.

From the free state 102, the state diagram of FIG. 4 proceeds to adecision step 104. At this step, a computing entity may claim ownershipof the lock 50A by writing its ID value into the owner field 51A. Thus,for example, the server 10 may write its ID value into the owner field51A. If a computing entity does claim ownership of the lock 50A, thedata entity transitions to a leased state 106. If ownership of the lockis not claimed by a computing entity at the decision step 104, the dataentity remains in the free state 102. At the leased state 106, acomputing entity has signed up for a renewable lease period by writingits ID value into the owner field 51A and by inserting a time value intothe time field 51B. Now, the computing entity is entitled to use thefile 48A until the lease expires, and other computing entities are notentitled to use the file 48A. In the preferred embodiment, a leaseexpires after a predetermined period of time, unless it is eitherrenewed or released prior to the expiration.

From the leased state 106, the state diagram proceeds to a decision step108. At this step, the computing entity that currently owns the lock 50Amay either release the lock, enabling another computing entity to gaincontrol of the lock, or it may renew the lease to ensure that it maycontinue using the file 48A. The lock can be released by writing a zeroto the owner field 51A. In this case, the state of the file 48A returnsto the free state 102 of the state diagram. The lease can be renewed bywriting a new time value to the time field 51B. In this case, the stateof the file 48A remains in the leased state 106, until the extendedlease period expires.

If, at the decision step 108, the lock is not released and the lease isnot renewed before the lease period runs out, then the lease expires. Inthis case, the file 48A transitions to a possessed state 110. Here, theowner field 51A still contains the ID value of the computing entity thatlast leased the file 48A and the time field 51B still contains the timevalue from the last time the computing entity leased the file 48A or thelast time the computing entity renewed a previous lease. At this point,the computing entity identified in the owner field 51A still hasexclusive access to the file 48A. However, the lease of the file 48A isnow vulnerable to being broken by another computing entity.

From the possessed state 110, the state diagram proceeds to a decisionstep 112. At this step, the computing entity that currently possessesthe lock 50A may still release the lock or it may still renew theprevious lease on the lock. Again, the lock can be released by writing azero to the owner field 51A, or the lease can be renewed by writing anew time value to the time field 51B. If the lock is released, the stateof the file 48A again returns to the free state 102, while, if the leaseis renewed, the state of the file 48A returns to the leased state 106.

If the file 48A is in the possessed state 110, another computing entitymay break the lease of the previous lessee and gain control of the file48A by writing its own ID value into the owner field 51A before the lockis released or the lease is renewed by the previous lessee. In thiscase, the state diagram proceeds to a step 114. At the step 114, theother computing entity may claim control of the lock 50A by writing itsown ID value into the owner field 51A and inserting a new time valueinto the time field 51B. At this point, the state diagram returns to theleased state 106, but with a new lessee.

Each of the data entities within the file system 42A, including allfiles, all directories and the file system 42A itself, continues totransition between the free state 102, the leased state 106 and thepossessed state 110 according to the state diagram of FIG. 4.

Now, suppose a computing entity is operating, and it determines that itneeds to access a data entity within the file system 42A. FIG. 5A is aflow chart illustrating a method that may be used, according to a firstembodiment of the invention, to attempt to gain control of a lock withinthe file system 42A. The following description is made in terms of theserver 10, the file 48A and the lock 50A, although it also applies toother computing entities and other data entities, along with theircorresponding locks. Thus, suppose the server 10 is operating and itdetermines that it needs to access the file 48A. FIG. 5A illustrates amethod that may be used to attempt to gain control of the lock 50A.

The method of FIG. 5A begins at an initial step 200. Next, at a step202, the server 10 reserves a data storage device or system thatcontains the lock 50A. This reservation may take any of a variety offorms. In the preferred embodiment, the data storage unit 40 implementsa conventional SCSI reservation system, by which the entire data storageunit 40 may be reserved. As is well known, under such a SCSI reservationsystem, the entire data storage unit 40 is locked for the exclusive useof the server 10 for as long as the SCSI reservation is in effect, fromthe time the server 10 issues a disk reserve primitive to the time theserver 10 issues a disk release primitive, or until a reset occurs. Inother embodiments of the invention, the SCSI reservation system may beused to reserve only a portion of the data storage unit 40. In stillother embodiments of the invention, the entire data storage unit 40 orsome portion of the data storage unit 40 may be reserved using someother temporary locking mechanism. For this description, suppose theentire data storage unit 40 is reserved using the SCSI reservationsystem. If the server 10 is unable to reserve the data storage unit 40because it has already been reserved by another computing entity, theserver 10 generally delays a certain period of time and then makesanother attempt to reserve the data storage unit 40, until the server 10is successful. At some point, however, the server 10 may give up ontrying to reserve the data storage unit 40, and return from the methodwith a failure condition. This approach of attempting multiple times toreserve the data storage unit 40 in the event that it is alreadyreserved is also used in the other methods described in thisapplication.

Next, the method of FIG. 5A proceeds to a decision step 204. At thisstep, the server 10 reads the owner field 51A and possibly the timefield 51B to determine the state of the file 48A. The server 10 can readboth the owner field 51A and the time field 51B at the same time, andonly use the value from the time field 51B if necessary, or the server10 can read the owner field 51A now and read the time field 51B later,only if necessary. If the owner field 51A contains a zero, then theserver 10 concludes that the file 48A is in the free state 102. If theowner field 51A contains an ID value for another computing entity, thenthe server 10 must determine whether a previous lease to this othercomputing entity has expired, to determine whether the file 48A is inthe leased state 106 or the possessed state 110. In many embodiments,the computing entity may not know of the ID values of all othercomputing entities. In such a case, the computing entity will preferablytake any value other than zero to be the ID value of another computingentity.

The determination of whether a previous lease has expired may beaccomplished in at least two different ways. A first method may be usedif the server 10 can trust the time values of other computing entitiesto accurately correlate with its own time values. A second method may beused if there may be a substantial discrepancy between the time valuesof the multiple computing entities, or if values other than time valuesare used in the time fields.

According to the first method, the server 10 reads the time value fromthe time field 51B. The server 10 then adds the lease period to thistime value to compute the expiration time of the prior lease. The server10 then compares the lease expiration time with the current time todetermine if the lease has expired.

In the second method for determining whether the prior lease hasexpired, the server 10 also reads the time value from the time field51B. The server 10 then releases the SCSI reservation that was made atthe step 202 and then delays for an entire lease period, with the leaseperiod being measured according to its own timing mechanisms. After thelease period expires, the server 10 again reserves the data storage unit40 using the SCSI reservation system and again checks the time value inthe time field 51B. If the time value in the time field 51B has changedbetween the first reading and the second reading, then the server 10concludes that the prior lease has not expired, while, if there was nochange in the time field 51B, the server 10 concludes that the priorlease has expired. A change in the time field 51B in this situationtypically means that the prior lease has been renewed by the previouslessee, although it can also mean that the prior lease was broken byanother computing entity. The server 10 may also double-check the ownerfield 51A at this point, although it should contain the ID value of someother computing entity. If, by chance, the owner field 51A contains azero at this point, the server 10 may conclude that the lock 50A isfree.

Returning now to the decision step 204, if the server 10 determines thatthe file 48A has been leased to another computing entity and that thislease has not expired, then the server 10 concludes that the file 48A iscurrently in the leased state 106. In this case, the method of FIG. 5Aproceeds to a step 214. If the server 10 determines that the file 48Ahas been leased to another computing entity, but that the prior leasehas expired, then the server 10 concludes that the file 48A is currentlyin the possessed state 110. In this case, the method of FIG. 5A proceedsto a step 206. If the server 10 concludes that the file 48A is in thefree state 102 based on the value in the owner field 51A, then themethod also proceeds to the step 206.

At the step 206, the server 10 claims control of the lock 50A by writingits own ID value into the owner field 51A and by writing a new timevalue into the time field 51B. The server 10 now has exclusive access tothe file 48A for a renewable lease period, beginning at this point intime. Next, the method proceeds to a step 208. At the step 208, theserver 10 releases the SCSI reservation so that other computing entitiesmay again access the data storage unit 40, although the other computingentities are not entitled to use the file 48A.

Next, at a step 210, the server 10 begins a renewal timer that is set totrack the time of a lease period. When the renewal timer goes off, theserver 10 may renew the current lease if the server is still using thefile 48A, so that the lease does not expire. After the step 210, themethod terminates at a step 212, with a successful acquisition of thelock 50A.

At the step 214, the server 10 also releases the SCSI reservation, butin this case the server 10 has not written its ID value into the ownerfield 51A to claim control of the lock 50A. At this point, the server 10is precluded from accessing the file 48A because another computingentity has control of the lock 50A.

Next, the method proceeds to a step 216. Here, the server 10 must decidewhether or not to give up on obtaining control of the lock 50A. In oneembodiment, the server 10 implements the second method described abovefor determining whether a prior lease has expired and, if the server 10concludes that the prior lease is still valid, generally indicating thatthe lessee of the prior lease has renewed its lease, then the server 10gives up on obtaining the lock immediately upon reaching the step 216.In other embodiments, the server 10 may attempt to obtain the lock anumber of times before giving up. If the server 10 does not give up onobtaining the lock 50A at the step 216, then the method proceeds to astep 218. At the step 218, the server 10 delays a period of time beforereturning to the step 202 to try again to obtain the lock 50A. If theserver 10 does give up on obtaining the lock 50A, the method proceeds toa terminal step 220. At this point, the server 10 returns to anothersoftware routine, reporting that the file 48A is not currentlyavailable.

FIG. 5B is a flow chart illustrating a method that may be used,according to a second embodiment of the invention, to attempt to gaincontrol of a lock within the file system 42A. This second embodiment ofthe invention involves the use of optional queues, such as the queues 46and 52A shown in FIG. 3. The use of queues, such as the queues 46 and52A generally promotes fairness between the computing entities withrespect to their ability to gain access to data entities. Without theuse of queues, the ability of the different computing entities to gaincontrol of a lock is dependent on the timing of their respectiveattempts to gain control of the lock and the time at which the lockbecomes available. One computing entity may be able to gain control of alock instead of another computing entity that has been waiting longer,simply because its timing was better relative to the time that the lockbecame available. In contrast, the use of queues helps to ensure thatcomputing entities that have been waiting longer may gain control of alock before computing entities that have been waiting for a shorterperiod of time.

Again, the following description is made in terms of the server 10, thefile 48A and the lock 50A, although it also applies to other computingentities and other data entities, along with their corresponding locks.Thus, suppose the server 10 is operating and it determines that it needsto access the file 48A. FIG. 5B illustrates a second method that may beused to attempt to gain control of the lock 50A.

The method of FIG. 5B begins at an initial step 230. Next, at a step232, the server 10 reserves the data storage unit 40, such as by using aSCSI reservation system. Next, the method of FIG. 5B proceeds to adecision step 234. This step 234 is performed in the same manner as thestep 204 of FIG. 5A to determine whether the file 48A is in the freestate 102, the leased state 106 or the possessed state 110. If theserver 10 concludes that the file 48A is in the leased state 106, themethod proceeds to a step 246. If the server 10 concludes that the file48A is in either the free state or the possessed state, then the methodproceeds to a step 236.

At the step 236, the server 10 determines whether the queue 52A isempty, or, more precisely, whether the queue 52A has any valid entries.In this example, the queue 52A consists of a first entry, represented bythe next1 field 53A and the time field 53B, and a second entry,represented by the next2 field 53C and the time field 53D. First, theserver 10 reads the value from the next1 field 53A. The server 10 mayalso read the values from the next2 field 53C and from the time fields53B and 53D at this point, for efficiency, although these additionalvalues may not be needed. If the next1 field 53A contains a zero, thenthe queue 52A is empty, and the method proceeds to a step 238. If thenext1 field 53A contains the ID value of another computing entity, thenthe other computing entity owns the first entry in the queue 52A. Next,however, the server 10 checks to see if this queue entry is still validby reading the time value in the time field 53B. This determination ofwhether a queue entry remains valid may be performed using the samemethods that are used to determine if a lease has expired. The amount oftime for which a queue entry remains valid may be the same as the leaseperiod, or it may be different. If the queue entry is no longer valid,then the server 10 moves on to check the second entry in the queue 52Aby reading the next2 field 53C and then possibly the time field 53D. Ifthe next2 field 53C contains a zero, then the second entry in the queue52A is empty. Otherwise, the time field 53D is used in the same mannerto determine if the second queue entry remains valid. If both entries inthe queue 52A are either empty or invalid, then the server 10 concludesthat the queue 52A is empty and the method proceeds to the step 238. Ifeither of the entries in the queue 52A contains a valid, nonzero entry,then the server 10 concludes that the queue 52A is not empty and themethod proceeds to a step 246.

At the step 238, the server 10 claims control of the lock 50A by writingits own ID value into the owner field 51A and by writing a new timevalue into the time field 51B. The server 10 now has exclusive access tothe file 48A for a renewable lease period, beginning at this point intime. Next, the method proceeds to a step 240. At this step, the server10 releases the SCSI reservation so that other computing entities mayagain access the data storage unit 40. Next, at a step 242, the server10 begins a renewal timer just as described above in connection with thestep 210 of FIG. 5A. Next, the method terminates at a step 244, with asuccessful acquisition of the lock 50A.

At the step 246, the server 10 places its name at the end of the queue52A, if the queue is not already full. If the next1 field 53A contains azero, then the first entry in the queue 52A is open, and the server 10writes its own ID value into the next1 field 53A and a new time valueinto the time field 53B, to claim the first entry in the queue. If thenext1 field 53A contains the ID value of another computing entity, thenthe first entry in the queue 52A has been taken, and the server 10 mustcheck the validity of both entries in the queue in the same manner asdescribed above. If both the first entry and the second entry are eitheropen or no longer valid, then the server 10 claims the first entry inthe queue by writing its own ID value into the next1 field 53A and a newtime value into the time field 53B. If the first entry in the queue isno longer valid, but the second entry in the queue is a valid entry,then the server 10 copies the second entry into the first entry andclaims the second entry for itself. To copy the second entry of thequeue into the first entry, the server 10 copies the value from thenext2 field 53C into the next1 field 53A and the server copies the valuefrom the time field 53D into the time field 53B. If the first entryremains valid and the second entry is either open or no longer valid,then the server 10 claims the second entry for itself. The server 10claims the second entry for itself by writing its own ID value into thenext2 field 53C and a new time value into the time field 53D. If both ofthe entries in the queue 52A contain valid entries, then the queue 52Ais full, and the server 10 proceeds without making any change to thequeue 52A. After the step 246, the method of FIG. 5B proceeds to a step248.

At the step 248, the server 10 releases the SCSI reservation, but inthis case the server 10 has not written its ID value into the ownerfield 51A to claim control of the lock 50A. At this point, the server 10is precluded from accessing the file 48A because another computingentity has control of the lock 50A. Next, the method proceeds to a step249. At the step 249, the server 10 begins a renewal timer that is setto track the time for which a queue entry remains valid. When therenewal timer goes off, the server 10 may renew the queue entry so thatthe queue entry remains valid. Next, the method proceeds to a terminalstep 250. At this point, the server 10 may return to another softwareroutine, reporting that the file 48A is not currently available.

In this embodiment of the invention, if the server 10 was able to claiman entry in the queue 52A at the step 246, then the server 10 waitsuntil the queue timer goes off, and then the server 10 renews the queueentry according to a method illustrated in FIG. 5C. Also during themethod of FIG. 5C, the server 10 checks to see if the lock 50A hasbecome available. If, however, an entry in the queue 52A was notavailable, the server 10 may delay for a period of time and execute themethod of FIG. 5B again until it is either able to gain control of thelock 50A or at least claim an entry in the queue 52A.

In this embodiment, as described below, when a lessee is finished usinga data entity, the lessee checks to see whether the queue for the dataentity indicates that another computing entity is waiting to use thedata entity. If there is a computing entity on the queue for the dataentity, then, when the lessee is finished with the data entity, thelessee copies the first valid entry in the queue into the owner fieldand time field of the lock, so that the computing entity that is next onthe queue gains control of the lock. However, this computing entity willnot realize that it has gained control of the lock until the next timeit goes to renew its queue entry.

Now, FIG. 5C illustrates a method that may be performed by a computingentity to attempt to renew its entry on a queue, such as the queues 46and 52A. Again, the following description is made in terms of the server10, the file 48A and the lock 50A, although it also applies to othercomputing entities and other data entities, along with theircorresponding locks. Thus, suppose the server 10 performed the method ofFIG. 5B and placed its ID value into one of the two entries of the queue52A. Then, when the queue timer goes off, the server 10 may perform themethod of FIG. 5C in an attempt to renew its queue entry.

The method of FIG. 5C begins at an initial step 260. Next, at a step261, the server 10 reserves the data storage unit 40, such as by using aSCSI reservation system. Next, at a step 262, the server 10 determineswhether its ID value remains either in the queue 52A or in the ownerfield 51A. Thus, the server 10 reads the values in the owner field 51A,the next1 field 53A and the next2 field 53C. If the server 10 does notfind its ID value in any of these fields, then the method proceeds to aterminal step 263 and the server 10 returns from the method with afailure condition. If the server 10 does find its ID value in one ofthese fields, then the method of FIG. 5C proceeds to a step 264.

At the step 264, the server 10 determines whether it is now entitled totake control of the lock 50A. The server 10 is entitled to take controlof the lock 50A in either of two circumstances. First, if the ID valueof the server 10 is found in the owner field 51A, then the server 10 isalready the owner of the lock 50A. This situation can arise if theprevious lessee copies the ID value of the server 10 from the queue 52Ainto the owner field 51A when the previous lessee releases control ofthe lock 50A. The server 10 is also entitled to take control of the lock50A if the previous lease has expired and if there are no valid entriesin the queue 52A that have a higher priority than the queue entry of theserver 10. Thus, the server 10 may need to check to see if the priorlease has expired and whether any higher priority queue entries remainvalid to determine whether it is entitled to take control of the lock50A. These determinations may be made in the same manners as describedabove. If the server 10 determines that it is now entitled to havecontrol of the lock 50A, then the method of FIG. 5C proceeds to a step270; otherwise, the method proceeds to a step 265.

At the step 265, the server 10 writes a new time value to its entrywithin the queue 52A. Thus, if the ID value of the server 10 is in thenext1 field 53A, then the server 10 writes a new time value to the timefield 53B, while, if the ID value of the server 10 is in the next2 field53C, then the server 10 writes a new time value to the time field 53D.Next, at a step 266, the server 10 updates the queue 52A. Specifically,if the server 10 owns the second entry in the queue 52A, the server 10checks the validity of the first entry in the queue 52A as describedabove. If the first entry in the queue 52A is no longer valid, then theserver 10 claims the first entry by writing its ID value into the next1field 53A and by writing a new time value into the time field 53B. Theserver 10 also writes a zero into the next2 field 53C to clear thatentry.

Next, the method of FIG. 5C proceeds to a step 267. At the step 267, theserver 10 releases the SCSI reservation so that other computing entitiesmay again access the data storage unit 40. Next, at a step 268, theserver 10 restarts the queue timer that was originally started at thestep 249 of FIG. 5B. Next, the method terminates at a step 269, with asuccessful renewal of the entry in the queue 52A.

At the step 270, the server 10 effectively claims control of the lock50A. If the owner field 51A does not already contain the ID value of theserver 10, then the server 10 does claim control of the lock 50A bywriting its own ID value into the owner field 51A and by writing a newtime value into the time field 51B. If the owner field 51A alreadycontains the ID value of the server 10, then the server 10 simply writesa new time value into the time field 51B. In either case, the server 10now has exclusive access to the file 48A for a renewable lease period,beginning at this point in time.

Next, the method proceeds to a step 271. At the step 271, the server 10updates the queue, if necessary. If the next1 field 53A contains the IDvalue of the server 10 and the second entry of the queue 52A contains avalid entry, then the server 10 copies the second entry of the queueinto the first entry, by copying the ID value from the next2 field 53Cto the next1 field 53A and by copying the time value from the time field53D to the time field 53B. In this case, the server 10 also clears thesecond entry in the queue by writing a zero to the next2 field 53C. Ifthe next1 field 53A contains the ID value of the server 10 and thesecond entry in the queue 52A does not contain a valid entry, then theserver 10 clears the first entry in the queue by writing a zero to thenext1 field 53A. If the next2 field 53C contains the ID value of theserver 10, then the server 10 clears the second entry in the queue bywriting a zero to the next2 field 53C.

Next, at a step 272, the server 10 releases the SCSI reservation so thatother computing entities may again access the data storage unit 40.Next, at a step 273, the server 10 begins a renewal timer just asdescribed above in connection with the step 210 of FIG. 5A. Also at thisstep, the server 10 may stop the queue timer that was started at thestep 249 of FIG. 5B. Next, the method terminates at a step 274, with asuccessful acquisition of the lock 50A.

In either the first embodiment or the second embodiment described above,when a computing entity has gained control of a data entity by acquiringthe respective lock, the computing entity will preferably continue torenew its lease on the data entity for as long as it needs to access thedata entity. A renewal timer was started for this purpose at the step210 of FIG. 5A, at the step 242 of FIG. 5B or at the step 273 of FIG.5C. When this renewal timer goes off, the computing entity may performthe method of FIG. 5D to renew its lease. Again, the followingdescription is made in terms of the server 10, the file 48A and the lock50A, although it also applies to other computing entities and other dataentities, along with their corresponding locks. Thus, suppose the server10 currently has a lease of the lock 50A, and its renewal timer justwent off. The server 10 may perform the method of FIG. 5D to renew thelease.

The method of FIG. 5D begins at an initial step 280. Next, at anoptional step 282, the server 10 reserves the data storage unit 40, suchas by using a SCSI reservation system. This step is optional because, inmany implementations, it will not be necessary to reserve the datastorage unit 40 because the steps that are performed in this method donot risk corrupting any data in the file system 42A. In such a case, theSCSI reservation is not used, so that other computing entities cancontinue using the file system 42A, which improves the overallperformance of the system.

After the step 282, the method of FIG. 5D proceeds to a decision step284. In this step, the server 10 reads the value in the owner field 51Ato determine if it is still the owner of the lock 50A. If the ownerfield 51A contains the ID value for the server 10, then the server 10 isstill the owner of the lock 50A, and the method proceeds to a step 288.If the owner field 51A does not contain the ID value for the server 10,then some sort of error has occurred. In this case, the methodterminates at a step 286, returning a failure condition.

At the step 288, the server 10 renews its lease on the lock 50A bywriting a new time value into the time field 51B. The server 10 now hasexclusive access to the file 48A for another lease period, beginning atthis new point in time. This write to the time field 51B may beperformed by one of at least two methods. First, the server 10 maysimply write to the data block containing the time field 51B, withoutperforming the SCSI reservation at the optional step 282, and withoutfirst reading the data block. In this case, the server 10 uses anupdated value for the time field 51B and the last known data for therest of the data block. This can generally only be done if none of thedata within the data block is subject to change by another computingentity because any such changes would generally be overwritten by theserver 10. For example, if the queue 52A is used, the queue 52A shouldbe located in a different data block from the time field 51B; otherwisethe server 10 may blindly overwrite any queue data the next time itrenews a lease. For the same reason, the queue 46 should be in adifferent data block from the time field 45B if this method will be usedto write to the time field 45B to renew the lock 44. The second methodinvolves performing the SCSI reservation at the step 282, reading thedata block containing the time field 51B, updating the value for thetime field 51B and writing the data block back to the file 48A.

Next, the method proceeds to an optional step 290. This optional step290 is performed if the step 282 was performed earlier in the method. Atthis step 290, the server 10 releases the SCSI reservation so that othercomputing entities may again access the data storage unit 40. Next, at astep 292, the server 10 restarts the renewal timer so that it can benotified again before this new lease period ends. Next, the methodterminates at a step 294.

In either the first embodiment or the second embodiment described above,if a computing entity is finished accessing a data entity before itslease for the data entity expires, the computing entity preferablyreleases the lock on the data entity, so that another computing entitymay acquire it. The computing entity may perform the method of FIG. 5Eto release the lock. Again, the following description is made in termsof the server 10, the file 48A and the lock 50A, although it alsoapplies to other computing entities and other data entities, along withtheir corresponding locks. Thus, suppose the server 10 currently has alease of the lock 50A, but it has finished accessing the file 48A. Theserver 10 may perform the method of FIG. 5E to release the lock 50A.

The method of FIG. 5E begins at an initial step 300. Next, at a step302, the server 10 stops the renewal timer that was started at the step210 of FIG. 5A, at the step 242 of FIG. 5B or at the step 273 of FIG.5C. Next, at an optional step 304, the server 10 reserves the datastorage unit 40, such as by using a SCSI reservation system. This stepis optional for a reason that is similar to the reason that the step 282of FIG. 5D is optional. If the server 10 may complete the method of FIG.5E without having to (1) read a data block from the file 48A, (2) modifythe data in that data block and then (3) write the data block back tothe file 48A, then performing this method generally does not riskcorrupting any data in the file system 42A, and the SCSI reservation ispreferably not used. If such a read-modify-write must be performed,however, then the step 304 should be performed. Generally, the step 304must be performed if a queue is to be updated during this method or ifthe ownership of the lock is to be updated based on information from aqueue. If, however, the ownership of the lock is simply cleared in thismethod by writing a zero to the owner field, then the step 304 generallyneed not be performed.

After the step 304, the method of FIG. 5E proceeds to a decision step306. At this step, the server 10 reads the value in the owner field 51Ato determine if it is still the owner of the lock 50A. If the ownerfield 51A contains the ID value for the server 10, then the server 10 isstill the owner of the lock 50A, and the method proceeds to a step 310.If the owner field 51A does not contain the ID value for the server 10,then some sort of error has occurred. In this case, the methodterminates at a step 308, returning a failure condition.

At the step 310, the server 10 updates the ownership of the lock 50A andthe ownership of the queue 52A if the queue 52A is used. If the queue52A is not used or if it does not contain any valid entries, then theserver 10 simply releases the lock 50A by writing a zero to the ownerfield 51A and the method proceeds. If the queue 52A is used and if itcontains a valid entry, then the server 10 copies the highest priorityvalid entry into the lock 50A and the server 10 updates the queue 52A.If the first entry contains a valid entry, then the server 10 copies thefirst entry into the lock 50A by copying the ID value from the next1field 53A to the owner field 51A and the time value from the time field53B to the time field 51B. If the second entry also contains a validentry, then the server 10 also copies the second entry into the firstentry by copying the ID value from the next2 field 53C to the next1field 53A and the time value from the time field 53D to the time field53B, and the server 10 also clears the second entry of the queue 52A bywriting a zero to the next2 field 53C. If the first entry is valid, butthe second entry is not valid, then, after copying the first entry intothe lock 50A, the server 10 clears the first and second entries bywriting a zero to the next1 field 53A. If the second entry is valid, butthe first entry is not valid, then the server 10 copies the second entryinto the lock 50A by copying the ID value from the next2 field 53C tothe owner field 51A and the time value from the time field 53D to thetime field 51B, and the server 10 also clears the first and secondentries of the queue 52A by writing a zero to the next2 field 53C.

Next, the method proceeds to an optional step 312. This optional step312 is performed if the step 304 was performed earlier in the method. Atthis step 312, the server 10 releases the SCSI reservation so that othercomputing entities may again access the data storage unit 40. Next, themethod terminates at a step 316.

A first embodiment of this invention comprises the metadata illustratedin FIG. 3 related to the data entity locks, such as the locks 44 and50A, along with the methods of FIGS. 5A, 5D and 5E. This firstembodiment does not use queues, such as the queues 46 and 52A. In thisfirst embodiment, if a computing entity is unsuccessful in an attempt toacquire a lock, the computing entity must keep making additionalattempts to acquire the lock, or it will not be able to use the desireddata entity. The second embodiment, on the other hand, does use queues,such as the queues 46 and 52A. Thus, the second embodiment comprises themetadata illustrated in FIG. 3 related to the data entity locks, such asthe locks 44 and 50A, and the metadata related to the queues, such asthe queues 46 and 52A, along with the methods of FIGS. 5B, 5C, 5D and5E. In this second embodiment, if a computing entity is unsuccessful inan attempt to acquire a lock, the computing entity may generally placeits ID value on the respective queue, which gives the computing entitypriority over other computing entities in being able to acquire the lockwhen the data entity becomes available. As described above, thistechnique promotes fairness between the computing entities with respectto their abilities to acquire locks to obtain access to data entities.

Each of the first two embodiments enables a computing entity to acquirea lock for a data entity, such as a particular file, a particulardirectory or the file system itself. Any computing entity that hasaccess to the file system 42A may generally acquire any of these locksby following the methods described above. When a computing entityacquires one of these locks, the computing entity has exclusive accessto the corresponding data entity for a predefined, extendable leaseperiod. This exclusive access enables the computing entity to read datafrom the data entity and write data to the data entity. Thus, in thecase of the data entity being a file, the computing entity may read datafrom the file or write data to the file. The computing entity may alsoread or write any metadata related to the file that is contained withinthe file. In the case of the data entity being a directory or the filesystem itself, the computing entity may read or write any of themetadata related to the data entity. Thus, the computing entity mayrename a file, add a file to a directory, delete a sub-directory, etc.

In the preferred embodiment, the granularity of the locking mechanismfor this invention is at the file level. In the first two embodiments ofthe invention, computing entities may gain exclusive access to any filein the system. When one computing entity has exclusive access to a file,no other computing entity may access the file in any manner, to read orwrite data to the file or to read or modify any metadata contained inthe file. However, another computing entity may still access other filesin the file system 42A that are not currently owned by another computingentity. Such an implementation, in which computing entities are givenexclusive access on a file-level granularity, is often quite useful. Oneadvantage of the file-level granularity is that a server 10, 12 or 18may cache parts of an open file on the server, with no cache consistencyissues, as long as the cached data is discarded when the file is closed.In some situations, however, it may be advantageous to give multiplecomputing entities access to a single file at the same time, forread-only purposes, instead of giving exclusive access to a singlecomputing entity. For example, a configuration file may be created thatrepresents a standard VM. Any physical computer that can access theconfiguration file can run virtualization software that can then readthe configuration file and create on the physical computer system a newinstance of the standard VM. The configuration file may be set as aread-only file, so that multiple physical computers can be reading theconfiguration file at the same time, to create a different instance ofthe VM on each physical computer. FIGS. 6A and 6B show differentversions of locking metadata that may be used to provide thiscapability. In this case, for example, each of the servers 10, 12 and 18may obtain read-only access to the file 48A at the same time. When inthis read-only mode, none of the servers 10, 12 and 18 may write to thefile 48A, but each of them may read from the file.

FIG. 6A shows the data storage unit 40, containing a file system 42B.The file system 42B may be substantially the same as the file system42A, except for the changes to the metadata described below. The filesystem 42B may contain the same lock 44 as described above, includingthe owner data field 45A and the time data field 45B. The file system42B may also contain the same queue 46 as described above, including thenext1 data field 47A, the next2 data field 47C, and the time data fields47B and 47D. The file system 42B may also contain the same types of dataentities as the file system 42A and these data entities may besubstantially the same as the data entities of the file system 42A,except for the locking metadata, as described herein. The file system42B may contain a file 48B, for example, which is substantially the sameas the file 48A, except for the locking metadata as described herein.

The file 48B contains a lock 50B. The lock 50B contains an access field51C, which indicates whether the lock 50B is reserved for exclusive,read and write access by a single computing entity or whether the lock50B is available for read-only access by multiple computing entities.The lock 50B also comprises a plurality of owner data fields, namely anowner-1 data field 51D, an owner-2 data field 51F . . . and an owner-Ndata field 51R, along with a corresponding time data field for each ofthe owner data fields, namely a time data field 51E, a time data field51G . . . and a time data field 51S, respectively. Each of the ownerdata fields 51D, 51F and 51R may be substantially the same as the ownerdata field 51A of the lock 50A, except as described below, and the timedata fields 51E, 51G and 51S may be substantially the same as the timedata field 51B of the lock 50A, except as described below. If the timefields 51E, 51G and 51S will be updated using a simple write, instead ofa read-modify-write, as described above in connection with the step 288of FIG. 5D, then each of the time fields 51E, 51G and 51S should be in adifferent data block.

FIG. 6B shows the data storage unit 40, containing a file system 42C.The file system 42C may also be substantially the same as the filesystem 42A, except for the changes to the metadata described below. Thefile system 42C may contain the same lock 44 as described above,including the owner data field 45A and the time data field 45B. The filesystem 42C may also contain the same queue 46 as described above,including the next1 data field 47A, the next2 data field 47C, and thetime data fields 47B and 47D. The file system 42C may also contain thesame types of data entities as the file system 42A and these dataentities may be substantially the same as the data entities of the filesystem 42A, except for the locking metadata, as described herein. Thefile system 42C may contain a file 48C, for example, which issubstantially the same as the file 48A, except for the locking metadataas described herein.

The file 48C contains a lock 50C. The lock 50C contains the same accessfield 51C as the lock 50B, which indicates whether the lock 50C isreserved for exclusive, read and write access by a single computingentity or whether the lock 50C is available for read-only access bymultiple computing entities. Unlike the lock 50B, the lock 50C comprisesonly a single owner data field, namely an owner data field 51T, whichmay be substantially the same as the owner-1 data field 51D of the lock50B, except as described below, along with a single corresponding timedata field, namely a time data field 51U, which may be substantially thesame as the time data field 51E, except as described below. The lock 50Calso contains a count field 51V, which contains a count of the number ofcomputing entities that are currently signed up for read-only access ofthe file 48C. If the time field 51U will be updated using a simplewrite, instead of a read-modify-write, as described above in connectionwith the step 288 of FIG. 5D, then the count field 51V should be in adifferent data block from the time field 51U.

FIG. 6C is a flow chart illustrating a method that may be used by acomputing entity to attempt to gain control of a lock within a filesystem, when the lock has the metadata illustrated in either FIG. 6A or6B. The following description is made in terms of the server 10attempting to gain control of the locks 50B and 50C within the files 48Band 48C, respectively, although it also applies to other computingentities and other data entities, along with their corresponding locks.

The method of FIG. 6C begins at an initial step 330. Next, at a step332, the server 10 reserves the data storage device 40, such as by usingthe SCSI reservation system.

Next, the method of FIG. 6C proceeds to a step 334. At this step, theserver 10 determines three factors that determine which steps are to beperformed next. First, the server 10 determines the state (referred toas “Lock State” in the block for the step 334) of the file 48B or 48C,namely whether the file is in the free state 102, the leased state 106or the possessed state 110. Next, if the file 48B or 48C is in eitherthe leased state 106 or the possessed state 110, the server 10 furtherdetermines whether the file 48B or 48C has been reserved for exclusiveuse by another computing entity or whether it has been reserved forread-only use (referred to as “Access Mode” in the block for the step334). Third, the server 10 determines whether it needs to access thefile 48B or 48C for both reading and writing, or whether it only needsto read from the file 48B or 48C (referred to as “Access Needed” in theblock for the step 334).

To determine the Lock State and the Access Mode, the server 10 reads thelocking metadata from the file 48B or 48C. In the case of the file 48B,the server 10 reads the access field 51C, the owner-1 field 51D, thetime field 51E, the owner-2 field 51F, the time field 51G . . . theowner-N field 51R and the time field 51S. In the case of the file 48C,the server 10 reads the access field 51C, the owner field 51T, the timefield 51U and the count field 51V. The server 10 may read all of thesefields at one time, or it may read them individually or in groups, asneeded.

Turning first to the file 48B, if the owner-1 field 51D contains a zero,then the lock 50B is in the free state 102. If the owner-1 field 51Dcontains the ID value of another computing entity and the access field51C of the lock 50B contains a value that indicates that the lock 50Bhas been reserved for exclusive use, then the lock 50B has been leasedon an exclusive basis by the computing entity identified in the owner-1field. The time field 51E can now be used to determine if this exclusivelease has expired. This determination may be made in the same manners asdescribed above in connection with the step 204 of FIG. 5A. If the leasehas not expired, then the file 48B is in the leased state 106; if thelease has expired, then the file 48B is in the possessed state 110.

If the owner-1 field 51D contains the ID value of another computingentity and the access field 51C of the lock 50B contains a value thatindicates that the lock 50B has been reserved for read-only use, thenthe lock 50B has been leased on a non-exclusive, read-only basis by oneor more computing entities. In this case, any of the owner fields 51D,51F . . . 51R that contains the ID value of a computing entityrepresents a read-only lease to the respective computing entity. Thus,suppose the owner-1 field 51D and the owner-2 field 51F each containsthe ID value of a computing entity, and that all other owner fieldscontain a zero. In this case, there are two entities that are sharingaccess to the file 48B on a read-only basis. The expiration time of eachsuch lease can be determined by reference to the corresponding timefield 51E, 51G . . . 51S. Thus, the first lease to the computing entityidentified in the owner-1 field 51D expires according to the time field51E and the second lease to the computing entity identified in theowner-2 field 51F expires according to the time field 51G. Thesedeterminations may also be made in the same manners as described abovein connection with the step 204 of FIG. 5A. If all of the non-exclusiveleases have expired, then the lock 50B is in the possessed state 110,but if any of the non-exclusive leases has not yet expired, then thelock 50B is in the leased state 106.

Turning next to the file 48C, if the owner field 51T contains a zero,then the lock 50C is in the free state 102. If the owner field 51Tcontains the ID value of another computing entity and the access field51C of the lock 50C contains a value that indicates that the lock 50Chas been reserved for exclusive use, then the lock 50C has been leasedon an exclusive basis by the computing entity identified in the ownerfield. The time field 51U can now be used to determine if this exclusivelease has expired. This determination may be made in the same manners asdescribed above in connection with the step 204 of FIG. 5A. If the leasehas not expired, then the file 48C is in the leased state 106; if thelease has expired, then the file 48C is in the possessed state 110.

If the owner field 51T contains the ID value of another computing entityand the access field 51C of the lock 50C contains a value that indicatesthat the lock 50C has been reserved for read-only use, then the lock 50Chas been leased on a non-exclusive, read-only basis by one or morecomputing entities. In this case, the count field 51V generallyindicates the number of computing entities that are currently sharingaccess to the file 48C on a read-only basis. In this case also, the timevalue in the time field 51U may be used to determine when the last ofall pending leases will expire. Any computing entity that begins orrenews a non-exclusive lease writes a new time value to the time field51U, so that the time field 51U always represents the start time of themost recently begun or renewed lease. The determination of whether themost recent lease has expired may also be made in the same manners asdescribed above in connection with the step 204 of FIG. 5A. If the mostrecent non-exclusive lease has expired, then the lock 50C is in thepossessed state 110, but if the most recent non-exclusive lease has notyet expired, then the lock 50C is in the leased state 106.

In the case of either of the files 48B or 48C, the box representing thestep 334 in FIG. 6C indicates the possible outcomes of thedeterminations described above and the subsequent steps to be performedfor each possible set of outcomes. Specifically, if the file 48B or 48Cis determined to be in the free state 102, then the method of FIG. 6Cproceeds to a step 340 regardless of the Access Mode (represented by thevalue in the respective access field 51C) or the Access Needed (the typeof access required by the server 10). If the file 48B or 48C isdetermined to be in the leased state 106, the respective access field51C contains a value that indicates a read-only lease and the server 10needs only read-only access, then the method also proceeds to the step340. If the file 48B or 48C is determined to be in the possessed state110, then the method also proceeds to the step 340 regardless of thevalue in the respective access field 51C and regardless of the type ofaccess required by the server 10.

If the file 48B or 48C is determined to be in the leased state 106 andthe respective access field 51C contains a value that indicates anexclusive, read and write lease, then the method proceeds to a step 350regardless of the type of access required by the server 10. If the file48B or 48C is determined to be in the leased state 106, the respectiveaccess field 51C contains a value that indicates a read-only lease andthe server 10 needs both read and write access, then the method alsoproceeds to the step 350.

At the step 340, the server 10 initiates a lease for itself for use ofthe file 48B or 48C. The nature of the lease and the actions taken toinitiate the lease depend on the circumstances under which the server 10has arrived at this step. If the file 48B or 48C is in the free state102, then the server 10 may simply sign up for whatever type of lease itneeds. If the server 10 needs read and write access to the file 48B or48C, then the server 10 signs up for an exclusive lease by writing theappropriate value to the respective access field 51C. If the server 10needs only read access to the file 48B or 48C, then the server 10preferably signs up for a non-exclusive, read-only lease, again bywriting the appropriate value to the respective access field 51C. Forthe file 48B, the server 10 also writes its own ID value to the owner-1field 51D and a new time value to the time field 51E. For the file 48C,the server 10 also writes its own ID value to the owner field 51T and anew time value to the time field 51U. For read-only access to the file48C, the server 10 also writes a count of one to the count field 51V.

If the file 48B or 48C is in the leased state 106 and the lease is aread-only lease, then the server 10 signs up for a shared, read-onlylease with whichever other computing entities have already signed up forsuch a lease. For the file 48B, the server 10 begins with the owner-1field 51D and proceeds toward the owner-N field 51R, looking for thefirst owner field that contains a zero. The server 10 then writes itsown ID value into the first such owner field and then writes a new timevalue into the corresponding time field 51E, 51G . . . 51S. For example,if the owner-2 field 51F is the first owner field that contains a zero,then the server 10 writes its own ID value into the owner-2 field 51Fand a new time value into the time field 51G. For the file 48C, theserver 10 writes its own ID value into the owner field 51T and a newtime value into the time field 51U. The server 10 also increments thecount field 51V by one. Also, if the file 48B or 48C is in the possessedstate 110, the lease is a read-only lease and the server 10 needs onlyread-only access, then the server 10 also signs up for a shared,read-only lease with whichever other computing entities have alreadysigned up for such a lease. The server 10 signs up for this shared,read-only lease in the same manner as was just described.

Now if the file 48B or 48C is in the possessed state 110 and the leaseis an exclusive, read and write lease, then the server 10 must break theexisting lease and initiate its own lease. Also, if the file 48B or 48Cis in the possessed state 110 and the lease is a shared, read-onlylease, but the server 10 needs exclusive access, then the server 10 mustalso break the existing lease and initiate its own lease. In eithercase, for the file 48B, the server 10 writes its own ID value into theowner-1 field 51D and a new time value into the time field 51E. Theserver 10 also writes a zero to any other owner field that doesn'talready contain a zero. For the file 48C, the server 10 writes its ownID value into the owner field 51T and a new time value into the timefield 51U. The server 10 also writes a one to the count field 51V. Also,for either the file 48B or 48C, the server 10 writes an appropriatevalue to the respective access field 51C, depending on whether theserver 10 requires exclusive read and write access or whether it can getby with read-only access.

Next, the method proceeds to a step 342. At this step, the server 10releases the SCSI reservation so that other computing entities may againaccess the data storage unit 40. Next, at a step 344, the server 10begins a renewal timer that is set to track the time of a lease period.When the renewal timer goes off, the server 10 may renew the currentlease if the server is still using the file 48B or 48C by writing a newtime value in the same time field that it wrote to during the step 340.After the step 344, the method terminates at a step 346, with asuccessful acquisition of the lock 50B or 50C.

At the step 350, the server 10 also releases the SCSI reservation, butin this case the server 10 has not initiated a lease for itself. Theserver 10 has no authority to access the file 48B or 48C for either reador write access. Next, the method proceeds to a step 352. Here again,the server 10 must decide whether or not to give up on obtaining controlof the lock 50B or 50C. This step may be performed in substantially thesame manner as the step 216 of FIG. 5A. If the server 10 does not giveup on obtaining the lock 50B or 50C at the step 352, then the methodproceeds to a step 354. At this step, the server 10 delays a period oftime before returning to the step 332 to try again to obtain the lock50B or 50C. If the server 10 does give up on obtaining the lock 50B or50C, the method proceeds to a terminal step 356. At this point, theserver 10 returns to another software routine, reporting that the file48B or 48C is not currently available.

The method of FIG. 6C, along with the locking metadata of either FIG. 6Aor 6B and methods corresponding to the methods of FIGS. 5D and 5E, maybe used to provide multiple computing entities with concurrent access toa file system, with individual data entities within the file systembeing accessed in either a read and write mode by a single computingentity or in a read-only mode by one or more computing entities. Otherembodiments of the invention are also possible. For example, queues,such as the queues 46 and 52A, may also be used in conjunction with thelocking metadata shown in FIGS. 6A and 6B, using methods that correspondwith the methods of FIGS. 5B, 5C, 5D and 5E. In this case, if acomputing entity wants to lease a data entity on a basis that isincompatible with a current, unexpired lease, such as if either thedesired lease or the existing lease is exclusive, then the computingentity may claim an entry in a corresponding queue and then acquire thelock when it becomes available.

As mentioned above, this invention is particularly advantageous in avirtual computer system. Thus, the servers 10, 12 . . . 18 may include aplurality of VMs 13, as illustrated in FIG. 2. Each of the servers 10,12 . . . 18 may include zero, one or more VMs 13. Each VM 13 may attemptto acquire locks and access data entities within the file system 42independently of the other VMs 13, either within the same server or in adifferent server. Thus, for example, a first VM 13 within the server 10may acquire an exclusive lock on a first data entity, a second VM 13within the server 10 may acquire an exclusive lock on a second dataentity, a third VM 13 within the server 12 may acquire an exclusive lockon a third data entity, and a fourth data entity may be accessed by boththe second VM 13 and the third VM 13 on a read-only basis.

Allowing multiple VMs 13, executing on multiple physical computers, toconcurrently access a file system using this invention is advantageousfor at least three reasons. First, it is convenient and efficient toconfigure multiple VMs if they share a common file system. Analternative would be to give each VM a separate LUN (logical unitnumber) within the data storage unit 40, on which the VM can create itsown, separate file system. But then, a system administrator would haveto reconfigure the data storage unit 40 each time a new VM is added oreach time the storage resources assigned to the different VMs ismodified. Instead, a single LUN may be used to host a single file systemthat is used by all of the VMs on the multiple physical computers. Then,if an additional VM is added to the computer system, a new file maysimply be added to the file system and assigned to the new VM as avirtual disk drive. Also, if a change needs to be made to the storageresources assigned to each of the VMs, the metadata within the filesystem may be modified to, for example, increase the size of the filecontaining the virtual disk drive of one VM and decrease the size of thefile containing the virtual disk drive of another VM.

Second, the VMs 13 may be migrated between the multiple servers usingthe techniques described in the '217 application, and they can continueto use the same file system 42 within the same data storage unit 40,regardless of the physical computer on which they are executing, so longas they have access to the data storage unit 40 from any of the physicalcomputers. Third, the software routines needed to implement the methodsof this invention may be implemented in a virtualization layer that iscommon to each of the physical computers. Each of the servers 10, 12 and18 may contain a common virtualization platform for supporting themultiple VMs 13, and the inventive methods may be performed by thisvirtualization software. The guest software running within each of theVMs 13 may not even need to know that the file system is being sharedwith other computing entities.

This invention provides a distributed file system that allows multiplecomputing entities to concurrently access a file system, withoutrequiring that the computing entities send messages to each othercontaining locking information. In a typical computer system, thiseliminates the need for the computing entities to be networked togetherin a separate computer network. Also, in this invention, there is nomaster for any of the locking information, like there is in the priorart distributed file systems illustrated in FIG. 1B. Instead, in thisinvention, locking information is stored within the metadata of the filesystem itself and computing entities are able to check for and acquirelocks for data entities on their own, by reading and modifying thelocking information directly in the file system. In the preferredembodiment, the SCSI reservation system is used to lock the file systemwhile a computing entity is checking for and acquiring a lock, althoughother temporary locking mechanisms may also be used.

Any computing entity that may access the file system may modify thislocking information to acquire a lock on a data entity, withoutrequiring any extra configuration for either the computing entity or thefile system. This makes it easy for any server that is newly connectedto the data storage unit to immediately begin executing VMs, which maybe newly created or may be migrated from an existing server. Acquiring alock in this manner gives the computing entity a renewable lease to usethe data entity protected by the lock for a specified period of time,which may preferably be renewed for as long as desired by the computingentity. Once the lease period expires, however, from either an initiallease or a renewed lease, the lease may be broken by another computingentity that wants to obtain the lock. This breakable, renewable leaseensures that a crash of a computing entity does not tie up a lockindefinitely. Despite the failure of a computing entity that holds alock, once the lease on the lock expires, another computing entity mayunilaterally break the lease and claim the lock for itself.

What is claimed is:
 1. A computer system providing concurrent access todata stored in accordance with a file system, the computer systemcomprising: a plurality of computers, wherein each of the computersaccesses data in accordance with the file system, wherein at least oneof the computers is a server supporting the running of virtual machines;a data storage unit networked to each of the plurality of computers andstoring data in accordance with the file system, wherein the file systemenables a file that represents a virtual disk of a virtual machinecapable of being run on the server and is stored in the data storageunit to be accessible by each of the plurality of computers, withoututilizing a file server that is acting on behalf of any of the pluralityof computers to manage access to the file system, by storing within thedata storage unit an owner field in association with the file, the ownerfield accessible by the plurality of computers to determine whether oneof the plurality of computers currently has exclusive access to thefile.
 2. The computer system of claim 1, wherein the file system furtherstores within the data storage unit a validity field in association withthe file, the validity field accessible by the plurality of computers todetermine whether one of the plurality of computers identified in theowner field has valid access to the file.
 3. The computer system ofclaim 2, wherein the owner field and the validity field are included ina lock data structure corresponding to the file.
 4. The computer systemof claim 3, wherein the lock data structure further comprises an accessfield indicating whether the file is available for read-access bymultiple computers.
 5. The computer system of claim 4, wherein the lockdata structure further comprises a count field indicating a number ofcomputers currently possessing read-only access to the file.
 6. Thecomputer system of claim 4, wherein the lock data structure furthercomprises one or more additional owner fields and corresponding timefields to indicate computers having read-only access to the file.
 7. Thecomputer system of claim 2, wherein the validity field is configured tostore a value relating to a period of time in which the computeridentified in the owner field has valid access to the file.
 8. Thecomputer system of claim 1, wherein the owner field is configured tostore a unique identifier of one of the computers when the computer hasacquired exclusive access to the file.
 9. The computer system of claim1, wherein the file is further associated with a queue comprising one ormore additional owner fields to indicate other computers that arewaiting to access the file.
 10. The computer system of claim 1, whereinthe owner field is stored within the file.
 11. The computer system ofclaim 1, wherein the file system enables the file stored in the datastorage unit to be accessible by each of the plurality of computerswithout requiring that the plurality of computers send messages to eachother containing the owner field.
 12. A non-transient computer readablestorage medium comprising instructions that are to be executed in acomputer for accessing a file in a file system configured to provideconcurrent access to the data stored in accordance with the file system,wherein the computer is one of a plurality of computers networked to adata storage unit storing data in accordance with the file system, andwherein the instructions cause the computer to carry out the steps of:reading an owner field stored in the data storage unit and associatedwith the file, the owner field enabling the file to be accessible byeach of the plurality of computers, without utilizing a file server thatis acting on behalf of any of the plurality of computers to manageaccess to the file system, wherein at least one of the computers is aserver supporting the running of virtual machines and the filerepresents a virtual disk of a virtual machine capable of being run onthe server; if the owner field indicates that no other computercurrently has exclusive access to the file, writing a unique identifierof the computer into the owner field thereby acquiring exclusive accessto the file; if the owner field indicates that another computer hasexclusive access to the file, reading a validity field and, if the timevalidity field indicates that the computer no longer has valid access tothe file, writing the unique value into the ownership field therebyacquiring exclusive access to the file, else if the validity fieldindicates that the computer still has valid access to the file, delayingaccess to the file; and if exclusive access to the file has beenacquired, accessing the file.
 13. The non-transient computer readablestorage medium of claim 12, wherein the owner field and the timevalidity field are included in a lock data structure corresponding tothe file.
 14. The non-transient computer readable storage medium ofclaim 12, wherein the lock data structure further comprises an accessfield indicating whether the file is available for read-access bymultiple computers.
 15. The non-transient computer readable storagemedium of claim 14, wherein the lock data structure further comprises acount field indicating a number of computers currently possessingread-only access to the file.
 16. The non-transient computer readablestorage medium of claim 12, wherein the validity field is configured tostore a value relating to a period of time in which the computeridentified in the owner field has valid access to the file.
 17. Thenon-transient computer readable storage medium of claim 12, wherein theowner file and the validity field are stored within the file.
 18. Amethod for accessing a file in a file system configured to provideconcurrent access to data stored in accordance with the file system, themethod performed in a computer networked to a data storage unit storingdata in accordance with the file system and comprising: reading an ownerfield stored in the data storage unit and associated with the file, theowner field enabling the file to be accessible by each of the pluralityof computers, without utilizing a file server that is acting on behalfof any of the plurality of computers to manage access to the filesystem, wherein at least one of the computers is a server supporting therunning of virtual machines and the file represents a virtual disk of avirtual machine capable of being run on the server; if the owner fieldindicates that no other computer currently has exclusive access to thefile, writing a unique identifier of the computer into the owner fieldthereby acquiring exclusive access to the file; if the owner fieldindicates that another computer has exclusive access to the file,reading a validity field and, if the time validity field indicates thatthe computer no longer has valid access to the file, writing the uniquevalue into the ownership field thereby acquiring exclusive access to thefile, else if the validity field indicates that the computer still hasvalid access to the file, delaying access to the file; and if exclusiveaccess to the file has been acquired, accessing the file.
 19. The methodof claim 18, wherein the owner field and the time validity field areincluded in a lock data structure corresponding to the file.
 20. Themethod of claim 18, wherein the lock data structure further comprises anaccess field indicating whether the file is available for read-access bymultiple computers.
 21. The method of claim 20, wherein the lock datastructure further comprises a count field indicating a number ofcomputers currently possessing read-only access to the file.
 22. Themethod of claim 18, wherein the validity field is configured to store avalue relating to a period of time in which the computer identified inthe owner field has valid access to the file.
 23. The method of claim18, wherein the owner field and the validity field are stored within thefile.